<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>获取和设置参数</title>
    <style>
        #elem{
            min-height: 20px;
            background-color: red;
        }
    </style>
</head>
<body>
    <div id="elem" title="这是一个标题"></div>
    <div>
        <button>获取title</button>
        <button>设置新title</button>
    </div>
</body>
<script src="../js/jquery.js"></script>
<script>
    $("button:nth-child(1)").click(function(){
        let tit =$("#elem").attr("title")
        alert(tit)
    })
    $("button:nth-child(2)").click(function(){
        $("#elem").attr("title","我是新设置的标题") 
    })
</script>
</html>